import request from '@/utils/request'

export function getList(params) {
  return request({
    url: '/monitor/log/findAll',
    method: 'post',
    data: params
  })
}

export function getProjectList(params) {
  return request({
    url: '/monitor/project/selectAll',
    method: 'get',
    params
  })
}

export function getSourceList(data) {
  return request({
    url: '/monitor/datasource/findAll2',
    method: 'post',
    data
  })
}
// 规则运行异常记录
export function findAllConsoleError(data) {
  return request({
    url: '/monitor/findAllConsoleError',
    method: 'post',
    data
  })
}
//获取告警提醒
export function getWarnList(data) {
  return request({
    url: '/monitor/notice/findAll',
    method: 'post',
    data
  })
}
//获取流程运行异常记录
export function findTimingRuleExceptionCount(data) {
  console.log(data);
  return request({
    url: '/monitor/findTimingRuleExceptionCount',
    method: 'get',
    data
  })
}
// 获取数据库连接池连接数
export function findConnectionCount(data) {
  console.log(data);
  return request({
    url: '/monitor/datasource/findConnectionCount',
    method: 'get',
    data
  })
}
// 获取流程运行异常记录
export function selectSelected(data) {
  console.log(data);
  return request({
    url: '/monitor/log/selectSelected',
    method: 'post',
    data
  })
}
//告警提醒搜索
export function noticeselectSelected(data) {
  console.log(data);
  return request({
    url: '/monitor/notice/selectSelected',
    method: 'post',
    data
  })
}


export function findAllProjectName() {
  return request({
    url: '/monitor/findAllProjectName',
    method: 'get',
  })
}
export function findAllObjectName() {
  return request({
    url: '/monitor/findAllObjectName',
    method: 'get',
  })
}
export function findConsoleErrorSelected(data) {
  console.log(data);
  return request({
    url: '/monitor/findConsoleErrorSelected',
    method: 'post',
    data
  })
}
//定时规则记录搜索
export function findAllTimingRuleRecord(data) {
  console.log(data);
  return request({
    url: '/monitor/findAllTimingRuleRecord',
    method: 'post',
    data
  })
}
//监控源列表
export function findAll(data) {
  return request({
    url: '/monitor/object/findAll',
    method: 'post',
    data
  })
}
//监控源添加
export function findAlladd(data) {
  return request({
    url: '/monitor/object/add',
    method: 'post',
    data
  })
}
//监控源删除
export function findAlldeleteById(data) {
  return request({
    url: `/monitor/object/deleteById/${data}`,
    method: 'delete',
  })
}
//监控源修改
export function findAllselectById(data) {
  return request({
    url: `/monitor/object/selectById/${data}`,
    method: 'get',
  })
}
//监控源更新
export function findAlupdate(data) {
  return request({
    url: `/monitor/object/update`,
    method: 'post',
    data
  })
}
export function findAllResult(data) {
  return request({
    url: '/monitor/log/findAllResult',
    method: 'post',
    data
  })
}
//删除日志
export function logdeleteById(data) {
  return request({
    url: `/monitor/log/deleteById/?id=${data}`,
    method: 'get',
  })
}
//更新日志
export function updateSelected(data) {
  return request({
    url: '/monitor/log/updateSelected',
    method: 'post',
    data
  })
}
//处理日志的确定请求
export function update(data) {
  return request({
    url: '/monitor/log/update',
    method: 'post',
    data
  })
}
//更新项目
export function projectupdate(data) {
  return request({
    url: '/monitor/project/update',
    method: 'post',
    data
  })
}
// 根据id查询项目进行回显
export function updateProjectdeleteById(data) {
  return request({
    url: `/monitor/project/deleteById/${data}`,
    method: 'delete',
  })
}
// 根据id查询项目进行回显
export function updateProjectById(data) {
  return request({
    url: `/monitor/project/selectById/${data}`,
    method: 'get',
  })
}
// 添加项目
export function projectadd(data) {
  return request({
    url: `/monitor/project/add`,
    method: 'post',
    data
  })
}
// 删除项目
export function projectdeleteById(data) {
  return request({
    url: `/monitor/delete`,
    method: 'delete',
    data
  })
}
//系统监控列表数据
export function quartzselect(data) {
  return request({
    url: `/quartz/select`,
    method: 'get',
    data
  })
}
//系统监控
export function quartzresume(data) {
  return request({
    url: `/quartz/resume/?triggerName=${data}`,
    method: 'get'
  })
}
//系统监控
export function quartztrigger(data) {
  return request({
    url: `/quartz/reresh-shedule-trigger`,
    method: 'get',
    data
  })
}
//系统监控
export function quartzpause(data) {
  return request({
    url: `/quartz/pause/?triggerName=${data}`,
    method: 'get'
  })
}
//修改间隔时间
export function sheduletrigger(data) {
  return request({
    url: `/quartz/reresh-shedule-trigger/?triggerName=${data.id}&intervalTime=${data.htime}`,
    method: 'get'
  })
}
//异常处理结果列表
export function errorfindAll(data) {
  return request({
    url: `/error-handle/findAll`,
    method: 'post',
    data
  })
}
//规则运行异常批量处理
export function erroraddbatch(data) {
  return request({
    url: `/error-handle/add-batch`,
    method: 'post',
    data
  })
}
//规则运行异常处理
export function erroradd(data) {
  return request({
    url: `/error-handle/add`,
    method: 'post',
    data
  })
}
// 异常处理回显
export function errordelete(data) {
  return request({
    url: `/error-handle/delete`,
    method: 'delete',
    data
  })
}
// 异常处理处理
export function errorupdate(data) {
  return request({
    url: `/error-handle/update`,
    method: 'post',
    data
  })
}
//定时规则记录失败
export function monitorfindeone(data) {
  return request({
    url: `/monitor/findOne`,
    method: 'post',
    data
  })
}